package com.sskj.level.ui.activity;

import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.sskj.common.base.App;
import com.sskj.level.R;
import com.sskj.level.R2;
import com.sskj.level.bean.SpreadBean;
import com.sskj.level.presenter.SharePresenter;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.lib.util.ImageUtil;

import butterknife.BindView;

/**
 * @author Hey
 * Create at  2019/08/29
 */
@Route(path = RConfig.LEVEL_SHARE)
public class ShareActivity extends BaseActivity<SharePresenter> {
    @Autowired
    String profit;
    @Autowired
    String code;
    @Autowired
    String status;
    @Autowired
    String jiancang;
    @Autowired
    String pingcang;
    @BindView(R2.id.tvState)
    TextView tvState;
    @BindView(R2.id.tvWinMoney)
    TextView tvWinMoney;
    @BindView(R2.id.tvCurrencyType)
    TextView tvCurrencyType;

    @BindView(R2.id.tvIndexNumber)
    TextView tvIndexNumber;
    @BindView(R2.id.tvAveragePrice)
    TextView tvAveragePrice;
    @BindView(R2.id.ivDrawable)
    ImageView ivDrawable;

    @Override
    public int getLayoutId() {
        return R.layout.level_activity_share;
    }

    @Override
    public SharePresenter getPresenter() {
        return new SharePresenter();
    }

    @Override
    public void initView() {
        ARouter.getInstance().inject(this);
        mPresenter.apiUserRegisterlink();
        tvState.setText(status.equals("1") ? App.INSTANCE.getString(R.string.levelbuySellEnum1) : App.INSTANCE.getString(R.string.levelbuySellEnum2));

    }

    @Override
    public void initData() {
        tvWinMoney.setText(profit);
        tvIndexNumber.setText(jiancang);
        tvAveragePrice.setText(pingcang);
        tvCurrencyType.setText(code.replace("_", "").toUpperCase());
    }

    public void updateUI(SpreadBean data) {
        ImageUtil.setImage(data.getQrcode(), ivDrawable);
    }

}
